﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HOTEL.Dao;
using Hotel.Domain;
using System.Drawing;

namespace Hotel_Admin
{
    public partial class us_HelpStatusOfPhieuDat : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindData();
        }
        protected void BindData()
        {
            var list = new PhieuDatPhongDao().GetTrangThaiPhieuDat();
            rpHelp.DataSource = list;
            rpHelp.DataBind();
            uplist.Update();
        }

        protected void rpHelp_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (!e.Item.ItemType.Equals(ListItemType.Item) &&
               !e.Item.ItemType.Equals(ListItemType.AlternatingItem)) return;
            var source = rpHelp.DataSource as List<TRANG_THAI_PHIEU_DAT>;
            if (source != null)
            {
                var item = source[e.Item.ItemIndex];
                var control = e.Item.FindControl("pcolor") as Panel;
                if (control != null)
                {
                    control.BackColor = Color.FromName(item.Color);
                }

            }
        }
    }
}